<template>
  <div>
    <div class="noDate_page" v-if="totalLength == 0">
      <div class="noDate_icon"><i class="iconfont icon-null"></i></div>
      暂无数据！
    </div>
    <div class="gys_index_tit" v-show="contentshow">
      共有<strong class="str_red">{{todolist.totals}}</strong>张订单！
    </div>
  
    <div class="orderList_con" id="ordlist" v-show="contentshow">
      <!-- <div class="wl_order_num ft14">{{todolist.datas[0].ATVNo}}</div> -->
      <div class="orderList_mod"
           v-for="item in todolist.datas">        
        <div class="orderList_text">
          <div class="ipt_l_title">
            <label class="ipt_text_L">业务单号：</label>
            <div>{{ item.BBillNo }}</div>
          </div>
          <div class="ipt_l_title">
            <label class="ipt_text_L">送货地址：</label>
            <div>
              {{item.ArrivalProvince | province}}{{item.ArrivalCity | city}}{{item.ArrivalDistrict | district}}{{ item.ArrivalAddress }}
            </div>
          </div>
        </div>
        <div class="btn_bottom">
            <div class="carbtn" @click="carrtransiturl(item.BBillGuid)">录入</div>
        </div>
      </div>
  
    </div>
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      todolist: {
        datas: [
          {
            ATVNo: '0'
          }
        ],
        totals: '',
      },
      totalLength: 0,
      contentshow:false
    };
  },
  computed: {
    userinfo(){
      return localStorage.getItem('userinfo')?JSON.parse(localStorage.getItem('userinfo')):null;
    }
  },
  created() { 
    this.getData();
  },
  methods: {
    getData: function () {
      let query = {
        PageIndex: 1,
        PageSize: 99999,
        Guid: this.userinfo.BelongGuid,
      };
      
      this.Ajax.post('GetTransferList',query).then((res) => {
        if(res.IsSuccess){
          if (res.Datas.length > 0) {
            this.todolist.datas = res.Datas;
            this.todolist.totals = res.Datas.length;
            this.totalLength = res.TotalRecords;
            this.contentshow = true;
          } else {
            this.contentshow = false;
          }
        } else {
          this.Toast({
            message: res.ErrorMessage || '操作失败',
          });
        }
      }).catch(e => {
        console.log(e);
        this.Toast({
          message: '出现错误，请刷新重试'
        })
      });
    },

    carrtransiturl:function(Guid,BBillNo){
       this.$router.replace({
        path: 'transitdetail',
        query: {
          Guid:Guid,
          BBillNo: BBillNo
        }
      });
    }
  },
};
</script>